Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

feat: fix TypeScript declarations generation with tsup#42

Merged
christoph2806 merged 4 commits intodevelopfrom
feature/fix-typescript-declarations-41
Jun 3, 2025
Merged

feat: fix TypeScript declarations generation with tsup#42
christoph2806 merged 4 commits intodevelopfrom
feature/fix-typescript-declarations-41

Conversation

@christoph2806
Copy link
Copy Markdown
Member

Fix TypeScript Declarations Generation with tsup

🎯 Resolves Issue #41

This PR completely resolves the missing TypeScript declaration files issue by replacing the complex manual build setup with tsup, a specialized TypeScript library bundler.

🔧 Changes Made

Build System Overhaul

  • Replaced complex vite build && tsc --project tsconfig.build.json with simple tsup
  • Added tsup.config.ts with proper React component support
  • Removed manual TypeScript configuration files (tsconfig.build.json, vite.css.config.ts)
  • Updated package.json exports to match new file structure

Key Improvements

  • Automatic TypeScript declarations generation (index.d.ts, index.d.cts)
  • Proper React component support with JSX handling
  • Multiple output formats (ESM + CommonJS)
  • CSS bundling with source maps maintained
  • Browser compatibility with crypto polyfills
  • Simplified build process - single command

Technical Details

  • Platform: browser for proper Web API handling
  • External dependencies: React, React-DOM (peer dependencies)
  • Bundle nanoid: Ensures browser-compatible crypto usage
  • Target: ES2020 for modern browser support

🧪 Testing

  • Build verification: All outputs generated correctly
  • TypeScript compilation: Declarations work with consuming apps
  • Component exports: All 64+ components properly exported
  • Browser compatibility: No Node.js crypto imports in bundle
  • Showcase build: Consuming application builds successfully
  • All tests pass: Unit tests, accessibility tests, linting

📦 Generated Files

dist/
├── index.js          # ESM bundle
├── index.cjs         # CommonJS bundle
├── index.d.ts        # TypeScript declarations
├── index.d.cts       # CommonJS TypeScript declarations
├── index.css         # Styles
└── *.map             # Source maps

🚀 Impact

  • Developers can now import components with full TypeScript support
  • Build process is significantly simplified and more reliable
  • Package quality improved with proper library tooling
  • Future maintenance easier with specialized build tool

📋 Checklist

  • TypeScript declarations generated correctly
  • All components exported with proper types
  • Browser compatibility maintained
  • Build process simplified
  • Tests passing
  • Documentation updated (if needed)

This change resolves the core issue and provides a robust foundation for TypeScript support in the ui-kit package.

@christoph2806 christoph2806 merged commit 2caabcc into develop Jun 3, 2025
8 checks passed
@christoph2806 christoph2806 deleted the feature/fix-typescript-declarations-41 branch June 3, 2025 19:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant